<div class='container'>
     <div class="tabbable"> <!-- Only required for left/right tabs -->
	<?=$tab_header;?>
       <div class="tab-content" style='height:450px;'>
        <!--<div class="btn-group">
        <a class="btn btn-small dropdown-toggle" data-toggle="dropdown" href="#">Sort by
        <span class="caret"></span>
        </a>
        <ul class="dropdown-menu">
            <li><a href='#' onclick="_aksi('id_lokasi');"><i class='cus-star'></i> Kode</a></li>
            <li><a href='#' onclick="_aksi('nm_lokasi');"><i class='cus-star'></i> Descripsi</a></li>
        </ul>
        </div> <hr />-->
            <div class="tab-pane active" id="table1"><?=$this->zetro_auth->allAuth($list,'setting_laba_rugi');?></div>
       </div>
    </div>
<?=$modal;?>    
</div>
<? link_js('jquery.fixedheader','asset/js/');?>
<script language='javascript'>
$(document).ready(function(e) {
	$('#frm2').validationEngine();
	_show_data('kd_labarugi',true);
	$('#b_Save').click(function(){
		($('#frm2').validationEngine('validate'))?_simpan_data():'';
	})
	$('#d_Save').click(function(){ $('#myModal').modal('hide');})
	$('tr.tree-toggler')
		.live('click',function(){
		var id=$(this).attr('id');
		$(this).parent().children('tr.tree#t_'+id).toggle();})
		.live('mousemove',function(){ $(this).attr('title','Click for content detail');})
});

function _simpan_data()
{
	$.post('set_labarugi',$('#frm2').serialize(),function(result){
		_show_data('kd_labarugi',false);$('#myModal').modal('hide');
	})
}
function _show_data(id,tp)
{
	$.post('get_list_labarugi',{'ordby':id},
	function(result){
		$('#NewList tbody').html('');
		$('#NewList tbody').html(result);
		(tp==false)?'':$('#NewList').fixedHeader({'width':'70%','height':430});
	});
}

function btn_click(id,aksi)
{
	var idd=id.split(':');
	switch(aksi)
	{
		case 'add':
			_show_modal_add(idd[1]);
		break;
		case 'edit':
			_show_modal(idd[0],idd[1]);
		break;
		case 'del':
		jConfirm('Yakin data kode akun ini akan dikeluarkan dari neraca?','Confirm',function(r){
			if(r){
				$.post('del_labarugi',{'id':idd[0]},
				function(result){_show_data('kd_labarugi',false);})
			}
		})
		break;
				
	}
}

function _show_modal(id,kd)
{
	$.post('get_detail_labarugi',{'id':id,'kd':kd},function(result){
		var r=$.parseJSON(result)
		$('#id_neraca').val(r.id);
		$('#kd_labarugi').val(r.kd_labarugi).attr('readonly','readonly');
		$('#nm_labarugi').val(r.nm_labarugi).focus().select().removeAttr('readonly');
		$('#kd_akun').val(r.kd_labarugi).attr('readonly','readonly');
		$('#myModal').css({'top':'30%'}).modal('show');
	})
}
function _show_modal_add(kd)
{
	$.post('get_detail_labarugi',{'kd':kd},function(result){
		var r=$.parseJSON(result)
		$('#id_neraca').val('');
		$('#kd_labarugi').val(r.kd_labarugi).attr('readonly','readonly');
		$('#nm_labarugi').val(r.nm_labarugi).attr('readonly','readonly');
		$('#kd_akun').val('').focus().select().removeAttr('readonly');
		$('#myModal').css({'top':'30%'}).modal('show');
	})
}



</script>